home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
ZOOM_EX.ZIP
/
ZOOM1.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-12-25
|
6KB
|
256 lines
; (C)ode by Nic of IMP
JUMPS
SMART
LOCALS
DOSSEG
;───────────────────────────────────────────────────────────────────────────────
;███████████████████████████████████████████████████████████████████████████████
;───────────────────────────────────────────────────────────────────────────────
Time = 0 ; to show time equal this to unity
; some usefull macro's
; only for Motorola freaks !
movB MACRO dst,src
mov BYTE PTR dst,src
ENDM
movW MACRO dst,src
mov WORD PTR dst,src
ENDM
movL MACRO dst,src
mov DWORD PTR dst,src
ENDM
WaitKey MACRO
mov ah,7
int 21h
ENDM
PrintString MACRO String
mov dx,OFFSET String
mov ah,9
int 21h
ENDM
Exit2Dos MACRO ErrCode
mov ax,4c00h+ErrCode
int 21h
ENDM
Color MACRO Num,RComp,GComp,BComp
push dx
push ax
mov dx,3c8h
mov al,Num
out dx,al
mov dx,3c9h
mov al,RComp
out dx,al
mov al,GComp
out dx,al
mov al,BComp
out dx,al
pop ax
pop dx
ENDM
;───────────────────────────────────────────────────────────────────────────────
;███████████████████████████████████████████████████████████████████████████████
;───────────────────────────────────────────────────────────────────────────────
StackSeg Segment Para USE16 STACK 'STACK'
DW 512 DUP (?)
StackSeg Ends
;───────────────────────────────────────────────────────────────────────────────
DataSeg Segment Para USE16 'DATA'
CodeString DB 80 DUP (0)
ALIGN 16
Picture LABEL
INCLUDE TestZoom.pic
DB 320 DUP (0)
DataSeg Ends
;═══════════════════════════════════════════════════════════════════════════════
CodeSeg Segment Para USE16 'CODE'
ASSUME cs:CodeSeg , ds:DataSeg , ss:StackSeg
Prog Proc Far
call SetFree
mov ax,DataSeg
mov ds,ax
mov es,ax
cld
call InitGfxMode
call InstallColors
;═══════════════════════════════════════════════════════════════════════════════
call TstZoom
;═══════════════════════════════════════════════════════════════════════════════
WaitKey
call RestTxtMode
Finish: Exit2Dos 0
Prog Endp
;───────────────────────────────────────────────────────────────────────────────
;███████████████████████████████████████████████████████████████████████████████
;───────────────────────────────────────────────────────────────────────────────
; here, we'll just make a vertical zoom, it is faster, but it's not for that,
; I think it will be easier to understant if you have only one zoom & I've
; tried to keep my code clean & short.
OriginalSize DW 200
DestinationSize DW 0
Count DW ?
LineLength = 320 ; in bytes
TstZoom PROC NEAR
VBLLoop:
mov dx,3dah ; wait VBL
Wait1: in al,dx
test al,8
jne Wait1
Wait2: in al,dx
test al,8
je Wait2
IF Time
Color 0,20,0,0
ENDIF
; Zoom the Pic
mov ax,0a000h
mov es,ax
mov di,0
lea si,Picture
inc DestinationSize
cmp DestinationSize,201
jl GoodSize
mov DestinationSize,1
call ClearScreen
GoodSize:
mov cx,DestinationSize
mov Count,cx
mov ax,OriginalSize
mov bx,DestinationSize
mov bp,LineLength
; the 2 following lines are here to make a better approx
mov dx,ax
shr dx,1
ZoomLoop:
add dx,bx
add si,bp
cmp dx,ax
jl ZoomLoop
sub dx,ax
CopyOneLine:
mov cx,LineLength/2
REP movsw
sub si,bp
dec Count
jnz ZoomLoop
IF Time
Color 0,0,0,0
ENDIF
; Zoom the Pic
in al,60h ; read key
cmp al,039h
jne VBLLoop
ret
TstZoom ENDP
ClearScreen PROC NEAR
mov ax,0a000h
mov es,ax
mov ax,0
mov cx,320*200/2
REP stosw
ret
ClearScreen ENDP
;───────────────────────────────────────────────────────────────────────────────
;███████████████████████████████████████████████████████████████████████████████
;───────────────────────────────────────────────────────────────────────────────
; release memory
SetFree PROC NEAR
mov bx,ss
mov ax,es
sub bx,ax
mov ax,sp
add ax,15
mov cl,4
shr ax,cl
add bx,ax
mov ah,4ah
int 21h
ret
SetFree ENDP
;───────────────────────────────────────────────────────────────────────────────
InstallColors PROC NEAR
push ds
push cs
pop ds
lea si,PALETTE
mov cx,256
mov dx,03c8h
xor al,al
out dx,al
inc dx
cld
@@ColorLoop:
lodsb
shr al,3
out dx,al
loop @@ColorLoop
pop ds
ret
InstallColors ENDP
PALETTE LABEL
INCLUDE testzoom.pal
InitGfxMode PROC NEAR
mov ax,13h
int 10h
ret
InitGfxMode ENDP
RestTxtMode PROC NEAR
xor ah,ah
mov al,03h
int 10h
ret
RestTxtMode ENDP
;═══════════════════════════════════════════════════════════════════════════════
CodeSeg Ends
END Prog